home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: news.dcs.warwick.ac.uk!not-for-mail
- From: D.C.Molero@dcs.warwick.ac.uk (Daniel Castillo Molero)
- Subject: strange behaviour of doubles
- X-Nntp-Posting-Host: star
- Message-ID: <1996Mar4.014052.6236@dcs.warwick.ac.uk>
- Sender: news@dcs.warwick.ac.uk (Network News)
- Organization: Department of Computer Science, Warwick University, England
- Date: Mon, 4 Mar 1996 01:40:52 GMT
-
-
- Dear readers,
- Can anybody explain to me why the behaviour of the following little
- program is not the expected one ??
- It is supposed to read from std input pairs of doubles and print them,
- until 0.0 is input.
- The strange thing is that it doesn't print the input number, e.g. when
- I input 1.0 1.0 it prints 0.0078125 0.0078125
- I will appreciate very much any help.
-
-
- #include <stdio.h>
- #include <stdlib.h>
-
- main() {
- double x, y;
- scanf("%g", &x);
- while (x != 0.0) {
- scanf("%g", &y);
- printf("%g %g\n", x, y);
- scanf("%g", &x);
- }
- return(0);
- }
- --
- * Daniel Castillo. danmol@dcs.warwick.ac.uk *
-
-
-